package core.command
{
	import core.event.SocketEventID;
	import core.event.UnoEvent;
	import core.event.ViewEventID;
	
	public class InsertDeskCommand extends SuperCommand
	{
		public function InsertDeskCommand()
		{
			socketEvent = SocketEventID.INSERT_DESK;
			viewEvent = ViewEventID.INSERT_DESK;
		}
		
		override public function success(e:UnoEvent):void
		{
			db.tableList[e.data.tableID] = e.data;
			var creater:Object = db.userList[e.data.createrID];
			creater.tableID = e.data.tableID;
			for(var s:String in e.data.userList)
			{
				if(e.data.userList[s].userID==e.data.createrID)
				{
					creater.seatID = e.data.userList[s].seatID;
					break;
				}
			}
			creater.ready = "1";
		}
	}
}